package com.toprs.base.config

import com.alibaba.fastjson.serializer.SerializerFeature
import com.alibaba.fastjson.support.config.FastJsonConfig
import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter
import org.springframework.context.annotation.Configuration
import org.springframework.core.annotation.Order
import org.springframework.http.converter.ByteArrayHttpMessageConverter
import org.springframework.http.converter.HttpMessageConverter
import org.springframework.stereotype.Component
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer

@Configuration
@Component
@Order(0)
class WebFastJsonConfig : WebMvcConfigurer {

//    override fun configureMessageConverters(converters: MutableList<HttpMessageConverter<*>>) {
//        val fastConverter = FastJsonHttpMessageConverter()
//        val fastJsonConfig = FastJsonConfig()
//        fastJsonConfig.setSerializerFeatures(SerializerFeature.WriteMapNullValue)
//        fastJsonConfig.dateFormat = "YYYY-MM-dd HH:mm:ss"
//        fastConverter.fastJsonConfig = fastJsonConfig
//        converters.add(ByteArrayHttpMessageConverter())
//        converters.add(fastConverter)
//    }
}
